package cn.wcy.actual_combat.immutable_class01.demo1;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class CarLocationTracker {

    private Map<String, Location> locationMap = new ConcurrentHashMap<>();

    public void updateLocation(String carId, double x, double y) {
        Location location = locationMap.get(carId);
        location.setLocation(x, y);
    }

    public Location getLocation(String carId) {
        return locationMap.get(carId);
    }
}
